package com.cx.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cx.entity.Department;
import com.cx.entity.Employee;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DepartmentMapper extends BaseMapper<Department> {

//    @Select("select * from t_department where dep_id=#id")
    Department getDeptAndEmp(int id);
    List<Department> getDeptAndEmp1();
    @Select("select * from t_department where dep_id = #{id}")
    @Results({
            @Result(property = "depNo", column = "dep_no"),
            @Result(property = "employeeList", column = "dep_no",
                    many =@Many(select = "com.cx.mapper.EmployeeMapper.empsByDepNo"))
    })
    Department getDepAndEmp2(int id);

    @Select("SELECT  * from t_department where dep_no=#{depNo}")
    Department getDept(String depNo);



}
